<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:75:"E:\phpstudy2016\WWW\shopsum\public/../application/admin\view\index\sum.html";i:1520928989;s:57:"E:\phpstudy2016\WWW\shopsum\application\public\admin.html";i:1520912952;}*/ ?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>数据字典-<?php echo \think\Config::get('title'); ?></title>
    <link rel="stylesheet" href="../../../../public/static/public/boo3/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css">
    <link rel="stylesheet" href="__PUBLIC__/index/css/sytle.css">
    <script src="__PUBLIC__/public/js/jquery-2.1.4.min.js"></script>
    <script src="__PUBLIC__/public/js/vue.min.js"></script>
    <script src="__PUBLIC__/public/js/jquery.transit.js"></script>
    <script src="__PUBLIC__/public/js/jquery.timers-1.2.js"></script>
    <script src="__PUBLIC__/public/layer-v3.1.1/layer/layer.js"></script>
    <style>
        #container{
            padding: 0 30px;
        }
        nav{
            background-color: #f5f5f5;
            padding: 10px 20px;
            z-index: 99;
            margin-bottom: 15px;
        }
        @media screen and (max-width: 800px) {
            nav{
                display: none;
            }
        }
    </style>
    <script>
        var DINDEX = '/admin/index';
        var DUSER = '/admin/user';
        var DADMIN = '/admin';
        var DJOURNALISM = '/admin/journalism';
        var DCOUNT = '/admin/count';
        //页面
        function yeMian(url,fn = 1,this_json = {title:'信息',area:['400px','450px']}) {

            var index = layer.open($.extend({type:2,content:url,end:function () {
                    if(typeof fn != 'number' ){
                        fn();
                    }
                }},this_json));
        }

        //看图
        function loock_img(url) {
            url = url.data('img');
            if((typeof url) != 'string'){
                layer.msg('没有数据查看',{icon:2});
                return;
            }
            layer.open({
                type:2,
                title:false,
                closeBtn:false,
                area:['100%','100%'],
                content:"<?php echo url('loock/index',['on'=>'true']); ?>?url="+url
            })
        }
    </script>
    
<link rel="stylesheet" href="__PUBLIC__/admin/css/index.dictionaries.css">


</head>
<body>

<nav>
       <small><i class="fa fa-institution"></i></small> 首页 > <?php echo \think\Config::get('this_user_name'); ?> 默认页面
        <?php if(\think\Request::instance()->param('on') == 'true'): ?>
       <a href="javascript:;" onclick="parent.layer.close(parent.layer.getFrameIndex(window.name));"  title="关闭当前页面" class="btn btn-xs btn-default fa-pull-right " style="margin-left: 10px"><i class="fa fa-close"></i></a>
        <?php endif; ?>
    <a href="javascript:location.reload();" title="刷新" class="btn btn-xs btn-success fa-pull-right"><i class="fa fa-refresh"></i></a>
</nav>

<div id="container">
    <div class="col-xs-11 col-xs-offset-1">
        <form action="" method="post" id="form">
            <input type="hidden" name="id" value="<?php echo $id; ?>">
            <input type="hidden" name="index" v-model="pagindex">
            <div class="form-group input-group col-xs-3 pull-left">
                <label class="input-group-addon">实施年份</label>
                <input type="text" name="date" id="dateYY" class="form-control">
                <label class="input-group-addon" style="visibility : hidden"></label>
            </div>
            <div class="form-group input-group col-xs-3 pull-left">
                <label class="input-group-addon"><?php echo lang('项目学校'); ?></label>
                <input type="text" name="school" id="date" class="form-control">
                <label class="input-group-addon" style="visibility : hidden"></label>
            </div>
            <div class="form-group input-group col-xs-3 pull-left">
                <label class="input-group-addon"><?php echo lang('项目名称'); ?></label>
                <input type="text" name="name" id="date" class="form-control">
            </div>
            <div class="form-group  col-xs-3 pull-left">
               <a href="javascript:;" class="btn btn-info" onclick="getdata()"><?php echo lang('搜索按钮'); ?></a>
            </div>

        </form>
    </div>

    <div class="clearfix"></div>
    <div style="height: 20px;"></div>
    <div class="table-responsive" id="header">
        <table class="table table-bordered table-hover table-xs" v-cloak>
            <thead>
            <tr class="active">
                <th colspan="15" class="text-left">

                        <a href="javascript:;" @click="addData()" class="btn btn-info btn-sm"><i class="fa fa-plus"></i>
                            创建项目</a>
                        <a href="javascript:;" @click="tongji('<?php echo url("count/count_sum"); ?>')" class="btn btn-success btn-sm">
                        <i class="fa fa-calculator"></i> 项目统计
                        </a>
                        <a href="javascript:;" @click="tongji('<?php echo url("count/procedures_sum"); ?>')" class="btn btn-warning btn-sm">
                        <i class="fa fa-calculator"></i> 费用支出
                        </a>
                        <a href="javascript:;" @click="dao_chu()" class="btn btn-primary btn-sm">
                        <i class="fa fa-cloud-download"></i> 导出数据
                        </a>

                    <span class="fa-pull-right">总 <strong>{{count}}</strong> 条</span>
                </th>
            </tr>
            <tr class="active">
                <th class="text-center">项目<br/>序号</th>
                <th class="text-center">实施<br/>年份</th>
                <th class="text-center">项目<br/>类型</th>
                <th class="text-center">建设<br/>类型</th>
                <th class="text-center">项目<br/>学校</th>
                <th class="text-center">项目<br/>名称</th>
                <th class="text-center">面积<br/>数量</th>
                <th class="text-center">中标<br/>金额</th>
                <th class="text-center">决算<br/>金额</th>
                <th class="text-center">拨出<br/>金额</th>
                <th class="text-center">剩余<br/>金额</th>
                <th class="text-center">资金<br/>规划</th>
                <th class="text-center">审核<br/>状态</th>
                <th class="text-center">建设<br/>内容</th>
                <th class="text-center">系统<br/>操做</th>
            </tr>
            </thead>
            <tbody>
            <template v-for="(key,index) in list">
                <tr>
                    <td class="text-center"></td>
                    <td class="text-center">{{key.datadate}}</td>
                    <td class="text-center">
                        {{key.datacategory == 0?"<?php echo lang('土建'); ?>":"<?php echo lang('设备购置'); ?>"}}
                    </td>
                    <td>{{key.datatype == 0?"<?php echo lang('新建'); ?>":key.datatype == 1?"<?php echo lang('扩建'); ?>":key.datatype == 2?"<?php echo lang('维修'); ?>":key.datatype == 3?"<?php echo lang('改建'); ?>":'设备'}}</td>
                    <td  :title="key.dataschool">{{key.dataschool.slice(0,4)}}</td>
                    <td  :title="key.dataname">{{key.dataname.slice(0,4)}}</td>

                    <td  :title="key.datacount + (key.datacategory == 1?'台件套':'平方米')">
                        {{(key.datacount + (key.datacategory == 1?'台件套':'平方米')).slice(0,4)}}<!--{{}}-->
                    </td>
                    <td class="text-center">
                        <a href="javascript:;" onclick="loock_img($(this))" :data-img="key.databudgetary_price_img">{{key.databudgetary_price}}</a>

                    </td>

                    <td class="text-center">
                        <a href="javascript:;" onclick="loock_img($(this))" :data-img="key.datadetermine_mobile_img">
                            {{key.datadetermine_mobile}}
                        </a>
                    </td>
                    <td class="text-center">
                        {{key.momoney <=0?'0.00':key.momoney}}
                    </td>
                    <td class="text-center">
                        <template v-if="parseFloat(key.datadetermine_mobile) <= 0">
                            {{(key.databudgetary_price-key.momoney).toFixed(2)}}
                        </template>
                        <template v-else>
                            {{((key.datadetermine_mobile-key.momoney).toFixed(2))}}
                        </template>
                    </td>

                    <td class="text-center" :title="'<?php echo lang('中央'); ?>：'+key.dataaddress1+'<?php echo lang('自治区'); ?>：'+key.dataaddress2+'<?php echo lang('市级'); ?>：'+key.dataaddress3+'<?php echo lang('旗县'); ?>：'+key.dataaddress4">
                        <a href="javascript:;" onclick="loock_img($(this))" :data-img="key.datamoney_img">
                            {{key.datamoney}}
                        </a>

                    </td>

                    <td>
                        {{key.datastate == 0?"<?php echo lang('待审核'); ?>":key.datastate == 1?"<?php echo lang('通过'); ?>":"<?php echo lang('拒绝'); ?>"}}
                    </td>
                    <td  class="text-over text-center" :title="key.datacontent">
                        {{key.datacontent.slice(0,5,10)}}...

                    </td>
                    <td class="text-center">

                        <template v-if="key.datastate == 0 "><!--待审核-->
                            <a href="javascript:;" title="<?php echo lang('通过'); ?>" @click="upType(1,index)"><i class="fa fa-check"></i></a>
                            <a href="javascript:;" title="<?php echo lang('拒绝'); ?>" @click="upType(2,index)"><i class="fa fa-close"></i></a>
                            <a href="javascript:;" title="<?php echo lang('删除'); ?>" @click="upType(3,index)"><i class="fa fa-trash-o"></i></a>
                        </template>
                        <template v-else-if="key.datastate == 1"> <!--通过-->
                            <template v-if="key.datacategory == 1">
                                <a href="javascript:;" class="btn btn-xs" title="购置手续" @click="url('/admin/count/commencement_formalities/type/0/on/true/id/'+key.dataid)"> <i class="fa fa-eye"></i></a>
                                <a href="javascript:;" class="btn btn-xs" title="验收手续" @click="url('/admin/count/commencement_formalities/type/1/on/true/id/'+key.dataid)"><i class="fa fa-eyedropper"></i></a>
                                <a href="javascript:;" class="btn btn-xs" title="<?php echo lang('资金使用'); ?>" @click="url('/admin/count/rmb/on/true/id/'+key.dataid)"><i class="fa fa-krw"></i></a><!--<?php echo url('count/speed',['id'=>12]); ?>-->
                                <a href="javascript:;" class="btn btn-xs" title="<?php echo lang('项目进度'); ?>" @click="url('/admin/count/speed/on/true/id/'+key.dataid+'.html')"><i class="fa fa-fighter-jet"></i></a>
                            </template>
                            <template v-if="key.datacategory ==0">
                                <a href="javascript:;" class="btn btn-xs" title="<?php echo lang('开工手续'); ?>" @click="url('/admin/count/commencement_formalities/type/0/on/true/id/'+key.dataid)"> <i class="fa fa-eye"></i></a>
                                <a href="javascript:;" class="btn btn-xs" title="<?php echo lang('竣工手续'); ?>" @click="url('/admin/count/commencement_formalities/type/1/on/true/id/'+key.dataid)"><i class="fa fa-eyedropper"></i></a>
                                <a href="javascript:;" class="btn btn-xs" title="<?php echo lang('资金使用'); ?>" @click="url('/admin/count/rmb/on/true/id/'+key.dataid)"><i class="fa fa-krw"></i></a><!--<?php echo url('count/speed',['id'=>12]); ?>-->
                                <a href="javascript:;" class="btn btn-xs" title="<?php echo lang('项目进度'); ?>" @click="url('/admin/count/speed/on/true/id/'+key.dataid+'.html')"><i class="fa fa-fighter-jet"></i></a>
                            </template>
                            <a href="javascript:;" class="btn btn-xs" title="<?php echo lang('返回到拒绝'); ?>" @click="upType(2,index)"><i class="fa fa-mail-reply"></i></a>

                        </template>
                        <template v-if="key.datastate == 2 || key.datastate==0"> <!--拒绝-->
                            <template v-if="key.datacategory == 1">
                                <a href="javascript:;" title="<?php echo lang('修改'); ?>" @click="up(key.dataid,1)"><i class="fa fa-edit"></i></a>
                            </template>
                            <template v-else>
                                <a href="javascript:;" title="<?php echo lang('修改'); ?>" @click="up(key.dataid,0)"><i class="fa fa-edit"></i></a>
                            </template>
                        </template>

                    </td>
                </tr>

            </template>
            </tbody>
        </table>
    </div>
    <div id="Pagination"></div>

</div>


</body>
</html>

<!--分页-->
<link rel="stylesheet" href="/static/public/page/pagination.css">
<script src="/static/public/page/jquery.pagination.js"></script>
<!--日期-->
<link rel="stylesheet" href="/static/public/time/css/jedate.css">
<script src="/static/public/time/jquery.jedate.min.js"></script>
<!--统计-->
<script src="__PUBLIC__/public/amcharts/amcharts.js" type="text/javascript"></script>
<script src="__PUBLIC__/public/amcharts/pie.js" type="text/javascript"></script>
<style>
    .tongjikuang{
        width: 600px !important;
        height: 500px;
    }
</style>
<script>
    var app = new Vue({
        el: '#container',
        data: {
            list: [],
            pagindex:0
            ,wh:$('#form').serialize()
            ,count:0
        }
    });
    app.dao_chu = function () {
        location.href="<?php echo url('ex'); ?>?"+app.wh;
    }
    $("#dateYY").jeDate({
        format: "YYYY"
    });

    app.tongji = (url)=>{
        layer.open({
            type: 1,
            shift:4,
            skin:'tongjikuang',
            title:'统计数据',
            shadeClose: true, //开启遮罩关闭
            content: '<div id="chartdiv" style="width: 100%; height: 400px;"></div>',
            success:function () {
                var index = layer.load(1);
                $.get(url,app.wh,function (da) {
                    console.log(da);
                    var json = [];
                    $.each(da,function (i,n) {
                        json.push({
                            "country": n.name,
                            "litres": n.money
                        })
                    });
                    layer.close(index);
                    AmCharts.makeChart("chartdiv", {
                        type: "pie",
                        dataProvider: json,
                        titleField: "country",
                        valueField: "litres",
                        balloonText: "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>",
                        legend: {
                            align: "center",
                            markerType: "circle"
                        }

                    });
                });


            }
        });
    }

    app.up = (id,type=0)=>{
        layer.open({
            type:2,
            title:false,
            closeBtn:false,
            shift:'3',
            area:['100%','100%'],
            content:DCOUNT+'/upindex/on/true/id/'+id+'/type/'+type
        })
    }
    var getdata = function () {
        app.wh=$('#form').serialize();
        get_data(function (da) {
            $("#Pagination").pagination(da[1],{
                items_per_page:30,
                callback:function (fnindex) {
                    app.pagindex = fnindex;
                    app.wh = app.wh.replace(/\=\w+/,'='+app.pagindex);
                    get_data(function (da) {
                        app.list = da[0];
                    });
                }
            });
        });
    };
    get_data(function (da) {

        $("#Pagination").pagination(da[1],{
            items_per_page:30,
            callback:function (fnindex) {
                app.pagindex = fnindex;
                app.wh=$('#form').serialize();
                app.wh = app.wh.replace(/\=\w+/,'='+app.pagindex);
                get_data(function (da) {
                    app.list = da[0];
                });
            }
        });
    });

    //获取数据
    function get_data(fn) {
        layer.load(1);
        $.post(DINDEX + '/sum',app.wh, function (da) {
            app.list = da[0];
            app.count = da[1];
            fn(da);
            //添加编号
            app.$nextTick(function () {
                $('tbody tr').each(function (i,n) {
                    $(this).find('td').eq(0).html($(this).index()+(app.pagindex*30)+1);
                })
            });
            layer.closeAll();
        });
    }
    app.url = (url)=>{
        layer.open({
            type:2,
            title:false,
            closeBtn:false,
            area:['100%','100%'],
            content:url
        })
    }


    //通过拒绝删除 1 2 3
    app.upType=(type,index)=>{
        layer.confirm('<?php echo lang("是否确定"); ?>',function () {
            $.post(DCOUNT+'/uptyle',{type:type,id:app.list[index].dataid},function (da) {
                layer.closeAll();
                if(da == 1){
                    layer.msg('<?php echo lang("成功"); ?>',{icon:1,offset:'rb'})
                    $.post(DINDEX + '/sum',app.wh, function (da) {
                        app.list = da[0];
                    });
                }
                else{
                    layer.msg('<?php echo lang("失败"); ?>',{icon:2,offset:'rb',end:function () {
                            location.reload();
                        }})
                }
            })



        });

    }


    //添加内容
    app.addData = (type) => {
        layer.confirm('请选择添加类型？', {
            btn: ['<?php echo lang("添加土建"); ?>', '<?php echo lang("添加设备购置"); ?>'] //按钮
        }, function () {
            layer.closeAll();
            layer.open({
                type: 2,
                title:false,
                closeBtn:false,
                area: ['100%', '100%'],
                content: DCOUNT + '/index/on/true/type/0'
            })
        }, function () {
            layer.closeAll();
            layer.open({
                type: 2,
                title:false,
                closeBtn:false,
                area: ['100%', '100%'],
                content: DCOUNT + '/index/on/true/type/1'
            })
        });

    }
</script>
